﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WareHouse.App
{
    using WareHouse.Contract.Models;
    using WareHouse.Contract.Services;
    using WareHouse.Service.Services;

    public partial class FrmWareHouseDetail : Form
    {

        private IWareHouseService wareHouseService;
        public FrmWareHouseDetail()
        {
            wareHouseService = new WareHouseService();
            InitializeComponent();
        }

        private void FrmWareHouseDetail_Load(object sender, EventArgs e)
        {
            gridWareHouse.DataSource = wareHouseService.ListWareHouse();
        }

        private void gridView1_Click(object sender, EventArgs e)
        {
            try
            {
              var  model = (WareHouseModel)gridView1.GetRow(gridView1.GetSelectedRows()[0]);
              if (model != null)
              {
                  gridItem.DataSource = wareHouseService.ListItemByWareHouseId(model.WareHouseId);
              }
            }
            catch (Exception)
            {


            }
        }
    }
}
